//
//  DetailView.m
//  Double
//
//  Created by 袁庆秋 on 15/5/25.
//  Copyright (c) 2015年 袁庆秋. All rights reserved.
//

#import "DetailView.h"

@implementation DetailView

- (void)dealloc
{
    [_score release];
    [_showImage release];
    [_titleLabel release];
    [_positionLabel release];
    [_categorysLabel release];
    [_updateLabel release];
    [_totalNumLabel release];
    
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        //显示图片位置
        self.showImage = [[UIImageView alloc] initWithFrame:CGRectMake(5, 5, self.frame.size.width / 3, self.frame.size.height - 10)];
        self.showImage.layer.cornerRadius = 10;
        self.showImage.clipsToBounds = YES;
        [self addSubview:self.showImage];
        
        //名称
        self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.frame.size.width / 3 + 15, 5, self.frame.size.width / 3 * 2 - 40, self.frame.size.height / 5)];
        self.titleLabel.font = [UIFont systemFontOfSize:14];
        [self addSubview:self.titleLabel];
        
        //地区
        self.positionLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.frame.size.width / 3 + 15, 5 + self.frame.size.height / 5, self.frame.size.width / 3, self.frame.size.height / 8)];
        self.positionLabel.font = [UIFont systemFontOfSize:10];
        [self addSubview:self.positionLabel];
        
        //评分
        self.score = [[UILabel alloc] initWithFrame:CGRectMake(self.frame.size.width / 3 * 2 + 70, 10, 60, self.frame.size.height / 9)];


        [self addSubview:self.score];
        
        //category
        self.categorysLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.frame.size.width / 3 + 15, 5 + self.frame.size.height / 40 * 13, self.frame.size.width / 3 * 2 - 15, self.frame.size.height / 8)];
        self.categorysLabel.font = [UIFont systemFontOfSize:10];
        [self addSubview:self.categorysLabel];
        
        //updateLabel
        self.updateLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.frame.size.width / 3 + 15, 5 + self.frame.size.height / 40 * 18, self.frame.size.width / 3 * 2 - 15, self.frame.size.height / 8)];
        self.updateLabel.font = [UIFont systemFontOfSize:10];
        [self addSubview:self.updateLabel];
        
        //totalNumLabel
        self.totalNumLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.frame.size.width / 3 + 15, 5 + self.frame.size.height / 40 * 23, self.frame.size.width / 3, self.frame.size.height / 8)];
        self.totalNumLabel.font = [UIFont systemFontOfSize:10];
        [self addSubview:self.totalNumLabel];
        
        //立即播放按钮
        self.watchBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        self.watchBtn.frame = CGRectMake(self.frame.size.width / 3 + 15, 5 + self.frame.size.height / 4 * 3, self.frame.size.width / 4, self.frame.size.height / 4 - 5);
        self.watchBtn.layer.cornerRadius = 5;
        self.watchBtn.clipsToBounds = YES;
        [self.watchBtn setTitle:@"立即播放" forState:UIControlStateNormal];
        self.watchBtn.backgroundColor = [UIColor orangeColor];
        [self.watchBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [self.watchBtn setTitleColor:[UIColor grayColor] forState:UIControlStateHighlighted];
        [self addSubview:self.watchBtn];
        
        //分享按钮
        self.downLoadBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        self.downLoadBtn.frame = CGRectMake(self.frame.size.width / 12 * 7 + 30, 5 + self.frame.size.height / 4 * 3, self.frame.size.width / 4, self.frame.size.height / 4 - 5);
        self.downLoadBtn.layer.cornerRadius = 5;
        self.downLoadBtn.clipsToBounds = YES;
        [self.downLoadBtn setTitle:@"分享" forState:UIControlStateNormal];
        self.downLoadBtn.backgroundColor = [UIColor orangeColor];
        [self.downLoadBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [self.downLoadBtn setTitleColor:[UIColor grayColor] forState:UIControlStateHighlighted];
        [self addSubview:self.downLoadBtn];
        
        
    }
    return self;
}


@end
